const mysql = require('mysql');
const connection = mysql.createConnection({
    host:'localhost',
    user:'root',
    password:'111111',
    databases:'test'
})
connection.connect((err)=>{
    if(err){
        console.log(`connect to mysql error:${err.code}`);
    }else{
        console.log('connect to mysql successful');
    }
});

connection.on('error',(err)=>{
    console.log('mysql connection error'+ err.code);
})